<template class="uni-goods-nav">
  <view>
    <view class="uni-tab_seat"></view>
    <view class="uni-tab_cart-holder flex">
      <view class="flex uni-tab_cart-sub-box">
        <view v-for="(item, index) in options" :key="index" class="flex uni_tab_cart-button-left uni-tab_cart-item">
          <view class="uni-tab_icon">
            <image class="image" :src="item.icon" mode="widthFix" />
          </view>
          <text class="uni-tab_text">{{ item.text }}</text>
          <text class="uni-tab_num" v-if="item.info">
            <view v-if="item.info > 9" class="uni-tab_dots">{{ item.info }}</view>
          </text>
        </view>
      </view>
      <view :class="{'uni-tab_right': fill}" class="flex uni_tab_cart-sub-box">
        <view v-for="(item, index) in buttonGroup" :key="index" 
              :style="{backgroundColor: item.backgroundColor}" 
              class="flex uni-tab_cart-button-right uni-tab_color-y" 
              @click="buttonClick(index, item)">
          {{ item.text }}
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'UniGoodsNav',
  props: {
    options: {
      type: Array,
      default: () => []
    },
    buttonGroup: {
      type: Array,
      default: () => []
    },
    fill: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    buttonClick(index, item) {
      this.$emit('buttonClick', { index, item });
    }
  }
}
</script>

<style scoped>
.uni-tab_cart-holder {
  background-color: #fff;
  padding: 10rpx;
  box-sizing: border-box;
}
.flex {
  display: flex;
}
.uni-tab_cart-sub-box {
  align-items: center;
}
.uni_tab_cart-button-left {
  margin-right: 20rpx;
  align-items: center;
}
.uni-tab_icon .image {
  width: 40rpx;
  height: 40rpx;
  margin-right: 10rpx;
}
.uni-tab_text {
  font-size: 28rpx;
}
.uni-tab_num .uni-tab_dots {
  display: inline-block;
  width: 30rpx;
  height: 30rpx;
  line-height: 30rpx;
  text-align: center;
  background-color: #ff0000;
  color: #fff;
  border-radius: 50%;
  font-size: 24rpx;
  margin-left: 5rpx;
}
.uni-tab_right {
  justify-content: flex-end;
  flex: 1;
}
.uni-tab_cart-button-right {
  padding: 15rpx 30rpx;
  border-radius: 40rpx;
  color: #fff;
  font-size: 28rpx;
  margin-left: 20rpx;
}
</style>